package cc.mrbird.demo.controller;

import cc.mrbird.demo.service.TestAsyncService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: chenhs
 * @date: Created in 16:44 2020/3/25
 **/
@RestController
public class TestAsyncController {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    TestAsyncService testService;

    @RequestMapping("async")
    public void testAsync(){
        long start = System.currentTimeMillis();

        logger.info("异步方法开始");
        testService.asyncMethod();

        long end = System.currentTimeMillis();
    }


}
